<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="header.jsp" />      
    <div id="inner_wrap">

        <jsp:useBean id="ordermanagement" class="com.aal.model.OrderManagement">   
            <jsp:setProperty name="ordermanagement" property="orderID" value="${param.orderid}"/>
            <jsp:setProperty name="ordermanagement" property="username" value="${param.username}"/>
            <jsp:setProperty name="ordermanagement" property="orderdate" value="${param.orderdate}"/>
            <jsp:setProperty name="ordermanagement" property="totalnetprice" value="${param.totalnetprice}"/>
            <jsp:setProperty name="ordermanagement" property="discountvalue" value="${param.discountvalue}"/>
            <jsp:setProperty name="ordermanagement" property="shippingcost" value="${param.shippingcost}"/>
            <jsp:setProperty name="ordermanagement" property="taxcost" value="${param.taxcost}"/>
            <jsp:setProperty name="ordermanagement" property="totalprice" value="${param.totalprice}"/>
            <jsp:setProperty name="ordermanagement" property="status" value="${param.status}"/>
            <jsp:setProperty name="ordermanagement" property="shippingaddress" value="${param.shippingaddress}"/>
            <jsp:setProperty name="ordermanagement" property="receivername" value="${param.receivername}"/>
            <jsp:setProperty name="ordermanagement" property="customername" value="${param.customername}"/>
            <jsp:setProperty name="ordermanagement" property="billingaddress" value="${param.billingaddress}"/>
        </jsp:useBean>
        <jsp:useBean id="orderstatus" class="com.aal.model.OrderStatus">         
        </jsp:useBean>
        <form>
        <table class="bordered">
            <c:forEach items="${ordermanagement.viewAll}" var="item">
                <tr>
                    <td><c:out value="${item.orderID}"/></td>
                    <td><c:out value="${item.username.username}"/></td>
                    <td><c:out value="${item.orderDate}"/></td>
                    <td><c:out value="${item.totalNetPrice}" /></td>
                    <td><c:out value="${item.discountValue}" /></td>
                    <td><c:out value="${item.shippingCost}" /></td>
                    <td><c:out value="${item.taxCost}"/></td>
                    <td><c:out value="${item.totalPrice}" /></td>
                    <td>
                    <label for="status">Status</label>
                    <select>
                    <c:choose>
                        <c:when test="${item.status == '1'}">
                            <option selected>PENDING</option>
                            <option value="${2}">SHIPPED</option>
                            <option value="${3}">CANCLED</option>
                        </c:when>
                        <c:when test="${item.status == '2'}">
                            <option value="${1}">PENDING</option>
                            <option selected>SHIPPED</option>
                            <option value="${3}">CANCLED</option>
                        </c:when>
                        <c:when test="${item.status == '3'}">
                            <option value="${1}">PENDING</option>
                            <option value="${2}">SHIPPED</option>
                            <option selected>CANCLED</option>
                        </c:when>
                    </c:choose>
                    </select>
                    </td>
                    <td><c:out  value="${item.shippingAddress}"/></td>
                    <td><c:out  value="${item.receivername}"/></td>
                    <td><c:out  value="${item.receiverPhone}"/></td>
                    <td><c:out  value="${item.customerName}"/></td>
                    <td><c:out  value="${item.billingAddress}"/></td>
                    <td><a href="orderDetailManagement.jsp?orderID=${item.orderID}">View</a></td>
                </tr>
            </c:forEach>
        </table>
    </form>
    </div>

<jsp:include page="footer.jsp" />